Skip to content

chore: update default Python version to 3.14 - #4023

Draft
rickeylev wants to merge 5 commits into
bazel-contrib:mainfrom
rickeylev:update_default_python_314
Draft

chore: update default Python version to 3.14#4023
rickeylev wants to merge 5 commits into
bazel-contrib:mainfrom
rickeylev:update_default_python_314

Conversation

@rickeylev

Copy link
Copy Markdown
Collaborator

Update the default Python toolchain version from 3.11 to 3.14 to align
with newer Python releases and provide modern defaults out of the box.

This updates the default toolchain version configurations in the module
extension, documentation, and test suites. Additionally, it updates
whl_extract to adjust relative paths in RECORD when unpacking wheel
.data subdirectories to their target installation paths.

Update default Python toolchain version from 3.11 to 3.14 across MODULE.bazel, WORKSPACE, documentation, and tests. Also update whl_extract to adjust RECORD paths when unpacking .data directories.
@rickeylev rickeylev changed the title feat: update default Python version to 3.14 chore: update default Python version to 3.14 Aug 9, 2026

@rickeylev rickeylev left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aignas Can you double check the logic in python/private/pypi/whl_extract.bzl?

It said that the RECORD file had invalid paths: the original paths in the wheel were present, but its actually supposed to reflect the install path. In this case, we have e.g. https://github.com/bazel-contrib/rules_python/blob/main/tests/repos/whl_with_data1

Up above, L40-50 is where the remap of schemes occurs.

From what I can tell, I think its right. Starting in Python 3.14 it seems that metadata.files() is stricter.

That said, I'm not entirely confident in the rewritten values it gives. e.g. ../data/ ? I guess it's up-referencing up out of the site-packages dir and into the venv? I suppose that's correct.

@rickeylev

Copy link
Copy Markdown
Collaborator Author

I created #4025 to show as a repro for this metadata.files bug. I think this is pre-existing? It might just be that 3.14 got more strict about things.

@aignas

aignas commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

@aignas Can you double check the logic in python/private/pypi/whl_extract.bzl?

Hmm, if it is install path, then indeed the RECORD files will be incorrect and it seems that we need to rewrite them and we are not. We are just leaving whatever was in the wheel to begin with.

…on_314

# Conflicts:
#	python/private/pypi/whl_extract.bzl
@aignas

aignas commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Looks like this is very close - only requirements locking tests are remaining.

Update runfiles Path method signatures to match Python 3.14 typeshed
stubs and apply typing.override where available. Add legacy-cgi to
examples/wheel requirements so pypiserver starts on Python 3.13+.
rickeylev added a commit to rickeylev/rules_python that referenced this pull request Aug 23, 2026
…ility and fix match() (bazel-contrib#4100)

Align runfiles.Path method signatures with Python 3.14 typeshed stubs to
avoid type checker errors on newer Python releases. This also fixes a
bug where pattern matching failed on Python 3.12+.

This change splits the runfiles compatibility updates from PR bazel-contrib#4023.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants